<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>全部求购</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../../elementUI/index.css">
    <link rel="stylesheet" href="../../../css/index.css">
</head>

<body>
    <div id="app" class="minWidth">
        <el-form :inline="true" :form="form">

            <el-form-item>
                <!-- <span>公司:</span> -->
                <el-select clearable @change="change1" v-model="form.Enterprise_Info_SerialNumber" placeholder="请选择公司">
                    <el-option v-for="item in Enterprise" :key="item.value" :label="item.Enterprise_Name"
                        :value="item.Enterprise_Info_SerialNumber">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-input clearable v-model="form.Article_Name" placeholder="请输入商品名称" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSerach">查询</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="window.location.href = './Show.html'">我的求购</el-button>
                <el-badge :value="badge" :max="99" :hidden="badge == 0?true:false" class="item">
                    <el-button @click="window.location.href = './Message.html'">消息</el-button>
                </el-badge>
            </el-form-item>
        </el-form>

        <el-table :data="tableData.slice((form.page-1)*form.limit,form.page*form.limit)" stripe border
            height="calc(100vh - 140px)" style="width: 100%">
            <el-table-column align="center" label="序号" width="50" type="index"></el-table-column>
            <el-table-column align="center" prop="Article_Name" label="商品名"></el-table-column>
            <el-table-column align="center" prop="Release_Type" label="状态" width="100">
                <template v-slot="{row}">
                    <el-tag v-if="row.Total_Quantity!=row.Acquisition_Quantity" type="danger" size="small">求购中</el-tag>
                    <el-tag v-else type="success" size="small">已收购足量</el-tag>
                </template>
            </el-table-column>
            <el-table-column align="center" prop="Total_Quantity" label="需求总量"></el-table-column>
            <el-table-column align="center" prop="Starting_Quantity" label="起步量"></el-table-column>
            <el-table-column align="center" prop="Acquisition_Quantity" label="已收购量"></el-table-column>
            <el-table-column align="center" prop="Residue_Quantity" label="剩余需求量"></el-table-column>
            <el-table-column align="center" prop="Amount" label="预定金额"></el-table-column>
            <el-table-column align="center" prop="Unit" label="商品单位"></el-table-column>
            <el-table-column align="center" prop="Contacts" label="联系人"></el-table-column>
            <el-table-column align="center" label="企业详情" width="150">
                <template v-slot="{row}">
                    <div style="display: flex;align-items: center;">
                        <div :title="row.Enterprise_Name" style="width: 100%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
                            <span style="margin-right: 10px;">{{row.Enterprise_Name}}</span>
                        </div>
                        <el-tag type="primary" v-if="row.Enterprise_Info_SerialNumber!=Enterprise_Info_SerialNumber"
                            @click="Business(row.Enterprise_Info_SerialNumber)" size="small">点击查看</el-tag>
                    </div>
                </template>
            </el-table-column>
            <el-table-column align="center" label="操作" width="200">
                <template v-slot="{row}">
                    <div style="display: flex;justify-content: center;">
                        <el-tag type="info" style="margin-right: 10px;"
                            v-if="row.Enterprise_Info_SerialNumber==Enterprise_Info_SerialNumber">本企发布</el-tag>
                        <div v-else>
                            <el-button v-if="row.Total_Quantity!=row.Acquisition_Quantity" type="primary"
                            @click="isTransactionInstructions(row.Group_Seek_Purchase_SerialNumber)"
                            size="small">我要出售</el-button>
                            <el-tag v-else type="info" style="margin-right: 10px;">已结束收购</el-tag>
                        </div>
                    </div>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination background v-show="total > 0" @size-change="handleSizeChange"
            @current-change="handleCurrentChange" :current-page="form.page" :page-sizes="[10,20,30,50]"
            :page-size="form.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>
        <el-dialog title="交易须知" :visible.sync="TransactionInstructions" width="30%" center>
            <p>1、卖方在商城下单出售时，应首先熟悉商城。卖方填写出售信息时，须遵守以下规定：</p>
            <p>
                （一）充分阅读并理解买方发布的商品信息及要求，特别是对能影响交易的主要商品信息如该商品是现货销售还是商品预售、该商品的销售单价、销售数量、质量指标、付款时间与方式、交货时间、地点、方式等信息应认真阅读并准确理解。
            </p>
            <p>
                （二）卖方可根据自身要求在其意向出售的商品下填写本次出售的数量。特别需要注意的是，卖方仅能对出售数量进行填写，对商城展示的其他商品信息无法进行改动、变更。若买方在下单前对商品信息有其他要求，应提前与卖方沟通，经卖方修改商品信息后再行下单出售。
            </p>
            <p>（三）卖方确认出售数量后，在商城填写提货人信息及发票开具信息，填写完成提交订单后，即表示卖方完成了下单出售。
            <p>
                2、卖方提交订单后，针对买方下单的该部分商品，即构成买方对卖方发布商品要约行为的承诺，对买方发生法律效力，买方和卖方之间对该商品的买卖合同法律关系成立并生效。卖方应对其承诺行为承担法律责任，并按该商品展示的相关信息和要求进行履约。
            </p>
            <div style="text-align: center;" slot="footer" class="dialog-footer">
                <el-button @click="TransactionInstructions = false">拒 绝</el-button>
                <el-button type="primary" @click="bidding">同 意</el-button>
            </div>
        </el-dialog>
    </div>
    <script type="text/javascript" src="../../../js/jquery-3.6.0.min.js"></script>
    <script type="text/javascript" src="../../../js/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../../js/vue.min.js"></script>
    <script type="text/javascript" src="../../../elementUI/index.js"></script>
    <script type="text/javascript" src="../../../js/utils.js"></script>
    <script type="text/javascript" src="./js/AllNeeds.js"></script>
</body>

</html>